package zzps.exeed.kernel.tool;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class StrTool {
    public static boolean isEmpty(String s) {
        return s == null || s.length() == 0;
    }
    public static List<String> split(String text, char separator) {
        int off = 0,next = 0,length = text.length();
        ArrayList<String> list = new ArrayList<>(32);//大多数情景
        while ((next = text.indexOf(separator, off)) != -1) {
            list.add(text.substring(off, next));
            off = next + 1;
        }
        // If no match was found, return this
        if (off == 0){
            list.add(text);
            return list;
        }
        // Add remaining segment
        if (next < length)
            list.add(text.substring(off, length));
        return list;
    }
}
